package com.company.cloud.art.modules.api.fallback;

import com.company.cloud.art.modules.api.request.ArtistAddReq;
import com.company.cloud.art.modules.api.request.ArtistDelReq;
import com.company.cloud.art.modules.api.request.ArtistQueryReq;
import com.company.cloud.art.modules.api.request.ArtistUpdateReq;
import com.company.cloud.art.modules.api.response.Artist;
import com.company.cloud.art.modules.api.response.ArtistQueryResp;
import com.company.cloud.art.modules.api.service.ArtActRemoteService;
import com.company.cloud.art.modules.api.service.ArtArtistRemoteService;
import com.company.cloud.common.bean.BaseClientResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
import java.util.Set;

@Log4j2
@Component
public class ArtArtistRemoteServiceFallbackFactory implements FallbackFactory<ArtArtistRemoteService> {

    @Override
    public ArtArtistRemoteService create(Throwable cause) {

        return new ArtArtistRemoteService() {

            @Override
            public BaseClientResult<ArtistQueryResp> artistQuery(ArtistQueryReq request) {
                log.debug("+++++ArtArtistRemoteService.artistQuery() Fallback Error");
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<Artist> artistInfo(String artistNo) {
                log.debug("+++++ArtArtistRemoteService.artistInfo() Fallback Error");
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<List<Artist>> artistInfoList(Set<String> artistNos) {
                log.debug("+++++ArtArtistRemoteService.artistInfoList() Fallback Error");
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<Map<String, Artist>> artistInfoMap(Set<String> artistNos) {
                log.debug("+++++ArtArtistRemoteService.artistInfoMap() Fallback Error");
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<String> artistAdd(ArtistAddReq request) {
                log.debug("+++++ArtArtistRemoteService.artistAdd() Fallback Error");
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<String> artistUpdate(ArtistUpdateReq request) {
                log.debug("+++++ArtArtistRemoteService.artistUpdate() Fallback Error");
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<String> artistDel(ArtistDelReq request) {
                log.debug("+++++ArtArtistRemoteService.artistDel() Fallback Error");
                return BaseClientResult.callbackError();
            }
        };
    }
}
